<page-header [title]="'规则列表'">
  <nz-card [nzBordered]="false" class>
    <form nz-form [nzLayout]="'inline'" class="search__form" action="search">
      <div nz-row [nzGutter]="{ xs: 8, sm: 8, md: 8, lg: 24, xl: 48, xxl: 48 }">
        <div nz-col nzMd="8" nzSm="24">
          <nz-form-item>
            <nz-form-label nzFor="Name">规则名称</nz-form-label>
            <nz-form-control>
              <input nz-input [(ngModel)]="q.Name" name="Name" #UserName placeholder="请输入" />
            </nz-form-control>
          </nz-form-item>
        </div>
        <div nz-col nzMd="8" nzSm="24">
          <nz-form-item>
            <nz-form-label nzFor="Creator">创建人</nz-form-label>
            <nz-form-control>
              <input nz-input [(ngModel)]="q.Creator" name="Creator" #UserPhone placeholder="请输入" />
            </nz-form-control>
          </nz-form-item>
        </div>
        <div nz-col nzMd="8" nzSm="24" *ngIf="expandForm">
          <nz-form-item>
            <nz-form-label nzFor="CreatTime">创建时间</nz-form-label>
            <nz-form-control>
              <input nz-input [(ngModel)]="q.CreatTime" name="CreatTime" placeholder="请输入" /> 
            </nz-form-control>
          </nz-form-item>
        </div>

        <div nz-col [nzSpan]="expandForm ? 24 : 8" [class.text-right]="expandForm">
          <button nz-button type="submit" [nzType]="'primary'" (click)="getData()">搜索</button>
          <!--<button nz-button type="submit" (click)="getData()" [nzType]="'primary'" [nzLoading]="loading">查询</button>-->
          <button nz-button type="reset" (click)="reset()" class="mx-sm">重置</button>
          <a (click)="expandForm = !expandForm">
            {{ expandForm ? '收起' : '展开' }}
            <i nz-icon [nzType]="expandForm ? 'up' : 'down'"></i>
          </a>
        </div>
      </div>
    </form>
    <!--<button nz-button [nzType]="'primary'" [routerLink]="['/manage/user/userform']" [queryParams]="{Id:-1}">
        <i nz-icon nzType="plus"></i>
        <span>{{ 'button.new' | translate }}</span>
      </button>-->
    <!-- <button nz-button [nzType]="'primary'" (click)="openComponent(-1)" acl [acl-ability]="1">
        <i nz-icon nzType="plus"></i>
        <span>{{ 'button.new' | translate }}</span>
      </button> -->
    <button nz-button [nzType]="'primary'" (click)="openComponent('00000000-0000-0000-0000-000000000000')">
      <i nz-icon nzType="plus"></i>
      <span>{{ 'button.new' | i18n }}</span>
    </button>
    <ng-container *ngIf="selectedRows.length > 0">
      <button nz-button>批量操作</button>
      <button nz-button nz-dropdown [nzDropdownMenu]="batchMenu" nzPlacement="bottomLeft">
        更多操作
        <i nz-icon nzType="down"></i>
      </button>
      <nz-dropdown-menu #batchMenu="nzDropdownMenu">
        <ul nz-menu>
          <!--<li nz-menu-item (click)="remove()">删除</li>
            <li nz-menu-item (click)="approval()">批量审批</li>-->
        </ul>
      </nz-dropdown-menu>
    </ng-container>

    <st
      #st
      (change)="onchange($event)"
      expandAccordion
      [expandAccordion]="true"
      [columns]="columns"
      [data]="url"
      ps="10"
      [expand]="expand"
      [page]="page"
      [req]="req"
      [res]="res"
    >
      <ng-template #expand let-item let-index="index" let-column="column">
        <nz-card nzTitle="节点">
          <nz-table [nzNoResult]="null">

            <thead>
            <tr>
              <td>Id</td>
              <td>名称</td>
              <td nzAlign="center">执行器</td>
              <td>脚本类型</td>
              <td>测试状态</td>
              <td nzAlign="center">操作</td>
            </tr>  </thead>
            <tbody>
            <tr *ngFor="let _item of item.flows; let i = index; let odd = odd">
              <td>{{ _item.bpmnid }}</td>
              <td>{{ _item.flowname }}</td>
              <td>{{ _item.nodeProcessClass }}</td>
           
              <td>{{ _item.nodeProcessScriptType }}</td>
              <td>{{_item.flowType==='bpmn:Task'? _item.teststatus===1?'测试通过':'未测试':'' }}</td>
              <td>
           
              <a (click)="testunit(_item)">{{
                _item.flowType==='bpmn:Task'|| _item.flowType==='bpmn:StartEvent'?'条件测试':''
              
              }}</a>   
              
              <nz-divider nzType="vertical" *ngIf="_item.flowType==='bpmn:Task'?true:false"></nz-divider>
              
              <a (click)="testscript(_item)">{{
                _item.flowType==='bpmn:Task'?'脚本测试':''
              
              }}</a>
            
            </td>
            </tr> 
           </tbody>
          </nz-table>
        </nz-card>
      </ng-template>
      <ng-template st-row="rulestatus" let-i>
        <nz-badge [nzStatus]="i.statusType" [nzText]="i.statusText"></nz-badge>
      </ng-template>
    </st>
  </nz-card>
</page-header>
